home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacAddict 84
/
MacAddict_084_2003_08.iso
/
pc
/
Software
/
Utilities
/
Safari Enhancer 2.0.1.dmg
/
Safari Enhancer.app
/
Contents
/
Resources
/
c2ie.pl
next >
Wrap
Perl Script
|
2003-05-25
|
1KB
|
44 lines
#!/usr/bin/perl
##
# c2ie.pl
# convert chimera bookmarks to ie bookmark format
#
use Text::ParseWords;
# we're following IE's lousy html here, don't blame me just cause there's no HEAD or BODY tags.s
print( "<HTML>\n<!DOCTYPE NETSCAPE-Bookmark-file-1>\n<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=x-mac-roman\">\n<TITLE>Favorites</TITLE>\n\n<H1 >Favorites</H1>\n\n<DL><p>\n\n");
while( <> )
{
chomp;
@entries = &parse_line( '[<>]+', 0, $_ );
foreach $line ( @entries )
{
# empty folders are listed <.../>, and have no separate close tag
if( $line =~ m/folder name=(.*?)(?: (?:open|type)=(?:.*))*\/$/ )
{
print( "\t<DT><H3 OBJECT_TYPE=\"LINK\">$1</H3>\n\t<DL>\n\t</DL>\n" );
}
# folders with something in them have > not /> at the end, and later a </folder>
elsif( $line =~ m/folder name=(.*?)(?: (?:open|type)=(?:.*))*$/ )
{
print( "\t<DT><H3 OBJECT_TYPE=\"LINK\">$1</H3>\n\t<DL>\n" );
}
# close folder
elsif( $line =~ m/\/folder/ )
{
print( "\t</DL>\n\n" );
}
# actual bookmark entry
elsif( $line =~ m/bookmark name=(.*) href=(.*)\// )
{
print( "\t\t<DT><A HREF=\"$2\" OBJECT_TYPE=\"LINK\">$1</A>\n" );
}
}
}
print( "\n\n</DL></HTML>\n" );